package bytecharstream;

import java.io.FileReader;
import java.io.FileWriter;

public class together {

    public static void main(String[] args) throws  Exception{

        // 创建对象
        FileReader reader = new FileReader("src/File/together.txt");
        FileWriter writer = new FileWriter("src/File/togetherCopy.txt");

        // 定义一个int型的len、一个长度为1024的字符数组
        int len = 0;
        char[] subbfer = new char[1024];

        // 得到写入前的时间
        long begin = System.currentTimeMillis();

        // 遍历
        while((len=reader.read(subbfer))!=-1){
            writer.write(subbfer,0,len);
        }

        // 得到写入后的时间
        long end = System.currentTimeMillis();

        // 关闭流
        reader.close();
        writer.close();
    }
}
